/*
 * @Author: wangliang
 * @Date: 2018-04-28
 * @description: 其他信息 --> 竞品信息
*/

import { apiHttp } from '../../../apiHttp';
import Api from '../../../../api/company/comCompetitorController.api';
import { ComCompetitorDto, JsonResult, PageResult, ComInfoVo } from '../../../../api/Interface';
import { ComPBJSearchDto } from '../companyInterface';

export default {
    // 竞品运营标记为运营
    operativeCompetitors: async (comCompetitor: ComCompetitorDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(Api.operativeCompetitors, comCompetitor);
        return res;
    },
    // 根据企业id获取工商信息
    getComInfoById: async (companyId: number): Promise<ComInfoVo> => {
        const res: JsonResult = await apiHttp(Api.getComInfoById, {companyId});
        return res.data;
    },
    // 根据企业id和运营状态 列表
    getComCompetitorPage: async (comCompetitor: ComPBJSearchDto): Promise<PageResult> => {
        const res: JsonResult = await apiHttp(Api.getComCompetitorPage, comCompetitor);
        return res.data;
    },
     // 删除当前竞品信息数据
     deleteComCompetitorById: async (id: number): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(Api.deleteComCompetitorById, {id});
        return res;
    },

    // 添加竞品信息
    saveComCompetitor: async (comCompetitor: ComCompetitorDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(Api.saveComCompetitor, comCompetitor);
        return res;
    },
    // 编辑竞品信息
    updateComCompetitor: async (comCompetitor: ComCompetitorDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(Api.updateComCompetitor, comCompetitor);
        return res;
    },
};